package com.digital.herbarium.Entity;

import com.digital.herbarium.Enum.ResponseStatusEnum;

public class ResponseResult {
    private int code ;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    private String message ;

    private Object data ;

    public ResponseResult(ResponseStatusEnum responseStatusEnum) {

        this.code = responseStatusEnum.getCode();

        this.message = responseStatusEnum.getMessage();

    }

    public static ResponseResult SUCCESS(){

        return new ResponseResult(ResponseStatusEnum.SUCCESS );

    }

    public static ResponseResult FAILED(){

        return new ResponseResult(ResponseStatusEnum.FAILED );

    }

    public static ResponseResult TOKEN_FAILED(){

        return new ResponseResult(ResponseStatusEnum.TOKEN_FAILED );

    }

    public static ResponseResult NOT_FOUND(){

        return new ResponseResult(ResponseStatusEnum.NOT_FOUND );

    }

    public static ResponseResult SERVER_ERROR(){

        return new ResponseResult(ResponseStatusEnum.SERVER_ERROR );

    }


    public static ResponseResult FAILED(String message){

        ResponseResult responseResult = new ResponseResult(ResponseStatusEnum.FAILED );

        responseResult.setMessage(message);

        return responseResult;

    }

    public ResponseResult setData(Object data){

        this . data = data;

        return this ;

    }
}
